package logic

import (
	"context"
	"jdshopuser/user_srv/model/redis"

	"jdshopuser/user_srv/internal/svc"
	"jdshopuser/user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type SmsSendLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSmsSendLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SmsSendLogic {
	return &SmsSendLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *SmsSendLogic) SmsSend(in *user.SendSmsCodeRequest) (*user.SendSmsCodeResponse, error) {
	// todo: 短信发送

	//缓存短信验证码
	redis.RedisSetSmsCode(in.Mobile, in.Code, in.Sale)

	return &user.SendSmsCodeResponse{}, nil
}
